package com.android.launcher3;

import android.app.Application;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;

import com.tinker.coresdk.manager.InitParams;
import com.tinker.coresdk.manager.MainSDKInitializer;

import me.jessyan.autosize.AutoSizeConfig;
import me.jessyan.autosize.utils.AutoSizeUtils;

public class LauncherApplication extends Application {


    @Override
    public void onCreate() {
        super.onCreate();

        initAutoSize();

        try {
            initMainSDK();
        } catch (Exception e) {

        }
    }

    private void initAutoSize() {
        Context application = getApplicationContext();
        if (application == null) {
            application = AutoSizeUtils.getApplicationByReflect();
        }
        AutoSizeConfig.getInstance()
                .setLog(true)
                .init((Application) application)
                .setUseDeviceSize(false);
    }

    private void initMainSDK() {
        InitParams mainInitParams = new InitParams();
        MainSDKInitializer.getInstance().initMainSDK(getApplicationContext(), mainInitParams, new MainSDKInitializer.MainSdkInitListener() {
            @Override
            public void onMainSdkInitStart() {

            }

            @Override
            public void onMainSdkInitFailure(String reason) {

            }

            @Override
            public void onMainSdkInitSuccess() {

            }
        });
    }

    @Override
    public Resources getResources() {
        return super.getResources();
    }
}
